package cn.com.ksplatform.modules.system.navigation;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;

import cn.com.ksplatform.modules.system.auth.parammanager.model.PlatParamItem;
import cn.com.ksplatform.modules.system.auth.parammanager.service.PlatParamItemService;

@Controller
@RequestMapping("/navigation")
public class NavigationController {
	
	@Autowired
	PlatParamItemService paramItenService;
	
	@RequestMapping("/go")
	public String go(String type){
		String pageKey = "SYS_INDEX";
		if(StringUtils.hasText(type)){
			pageKey = pageKey+"_"+type;
		}
		PlatParamItem welcome = paramItenService.getParam(pageKey);
		if(welcome != null && StringUtils.hasText(welcome.getEvalue())){
			return welcome.getEvalue();
		}
		return "redirect:/view/modules/system/index.vm";
	}
}
